package kr.co.mcshop.admin;

import java.util.List;
import java.util.Map;

import kr.co.mcshop.user.UserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@RequestMapping(value="/admin")
@Controller
public class AdminUserController {
	
	@Autowired
	UserService us;
	
	@RequestMapping(value="/userList")
	public String userList(@RequestParam Map map,Model model){
		List<Map> userList = us.UserList(map);
		model.addAttribute("userList", userList);
		return "admin/user/userList";
	}
	
	@RequestMapping(value="/userDetail")
	public String userDetail(@RequestParam Map map,Model model){
		List<Map> userInfo = us.UserList(map);
		model.addAttribute("userInfo", userInfo);
		return "admin/user/userInfo";
	}
	
	@RequestMapping(value="/userDelete")
	public String userDelete(@RequestParam Map map,Model model){
		us.UserDelete(map);
		return "redirect:/admin/userList";
	}
}
